<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <?php echo $this->HelpUrl('orderRefundLog'); ?>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box shop-box">
                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="25%"><?php echo $this->translate('订单编号'); ?></th>
                                <th width="15%"><?php echo $this->translate('退款类型'); ?></th>
                                <th width="10%"><?php echo $this->translate('退款金额'); ?></th>
                                <th width="10%"><?php echo $this->translate('退款支付类型'); ?></th>
                                <th width="10%"><?php echo $this->translate('购买人'); ?></th>
                                <th width="15%"><?php echo $this->translate('完成时间'); ?></th>
                                <th width="8%"><?php echo $this->translate('操作'); ?></th>

                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            $sForm->get('return_type')->setEmptyOption('请选择');
                            $sForm->get('refund_pay_type')->setEmptyOption('请选择');
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?php echo $this->formElement($sForm->get('order_sn')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('order_sn'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('return_type')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('return_type'), ['class'=>'error-message']);?>
                                </td>
                                <td></td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('refund_pay_type')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('refund_pay_type'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('user_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('user_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('start_finish_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('end_finish_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('start_finish_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('end_finish_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = array_filter($sForm->getData());
                                    if(!empty($formData)) { ?>
                                        &nbsp;&nbsp;<a href="<?php echo $this->url('sales', ['action' => 'orderRefundLog']);?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->orderRefundLog->getCurrentItemCount() > 0) foreach ($this->orderRefundLog as $logValue) { ?>
                                <tr>
                                    <td>
                                        <?php echo $this->escapeHtml($logValue[0]->getOrderSn()); ?>
                                        <?php if ($logValue[0]->getOrderGoodsName()) echo '<br><small>' . $this->escapeHtml($logValue[0]->getOrderGoodsName()) . '</small>'; ?>
                                    </td>
                                    <td><?php echo $this->salesHelper()->getOrderRefundType($logValue[0]->getReturnType()); ?></td>
                                    <td><?php echo $logValue['currencySymbol'] . $logValue[0]->getReturnAmount(); ?></td>
                                    <td><?php echo $this->salesHelper()->getOrderGoodsReturnPayType($logValue[0]->getRefundPayType()); ?></td>
                                    <td><?php echo $this->escapeHtml($logValue[0]->getUserName()); ?></td>
                                    <td colspan="2"><?php echo $this->shopDateFormat()->orderGoodsReturnTime($logValue[0]->getFinishTime()); ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->orderRefundLog, 'Sliding', 'layout/page', ['route' => 'sales', 'params' => ['action' => 'orderRefundLog']]); ?>
                    </div>
                </div>
            </div>
        </div>

    </section>
</div>
<script type="text/javascript">
    laydate.render({elem: '#start_finish_time'});
    laydate.render({elem: '#end_finish_time'});
</script>